# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Simon Sapin <simon dot sapin at exyr dot org>
# Contributor: Kyle Keen <keenerd@gmail.com>

pkgname=python-factory-boy
pkgver=3.2.1
pkgrel=4
pkgdesc="A versatile test fixtures replacement based on thoughtbot's factory_bot for Ruby"
url="https://github.com/FactoryBoy/factory_boy"
license=('MIT')
arch=('any')
depends=('python-faker')
makedepends=('python-setuptools')
checkdepends=('python-pytest-runner' 'python-flask' 'python-django' 'python-sqlalchemy'
              'python-flask-sqlalchemy' 'python-mongoengine' 'python-mongomock')
source=("$pkgname-$pkgver.tar.gz::https://github.com/FactoryBoy/factory_boy/archive/$pkgver.tar.gz")
sha512sums=('45f88970fa2adf15160d489335d7843ebf78178ae619e6b1ad2cc2e3af8e6c14763cf1afe21bc4e66d1d7196458d8045862db4d5878d5cfc1f2aa658ccba1812')

prepare() {
  cd factory_boy-$pkgver
  # Use mongomock
  sed -i '/serverselectiontimeoutms/a is_mock=True' tests/test_mongoengine.py
}

build() {
  cd factory_boy-$pkgver
  python setup.py build
}

check() {
  cd factory_boy-$pkgver
  python setup.py pytest
}

package() {
  cd factory_boy-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
